In [1]:
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All" 
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
In [2]:
import pandas as pd
In [3]:
cw1 = pd.read_csv('https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv')
cw1
    
Out[3]:
iso_code continent location date total_cases new_cases new_cases_smoothed total_deaths new_deaths new_deaths_smoothed ... gdp_per_capita extreme_poverty cardiovasc_death_rate diabetes_prevalence female_smokers male_smokers handwashing_facilities hospital_beds_per_thousand life_expectancy human_development_index
0 ABW North America Aruba 2020-03-13 2.0 2.0 NaN 0.0 0.0 NaN ... 35973.781 NaN NaN 11.62 NaN NaN NaN NaN 76.29 NaN
1 ABW North America Aruba 2020-03-19 NaN NaN 0.286 NaN NaN 0.0 ... 35973.781 NaN NaN 11.62 NaN NaN NaN NaN 76.29 NaN
2 ABW North America Aruba 2020-03-20 4.0 2.0 0.286 0.0 0.0 0.0 ... 35973.781 NaN NaN 11.62 NaN NaN NaN NaN 76.29 NaN
3 ABW North America Aruba 2020-03-21 NaN NaN 0.286 NaN NaN 0.0 ... 35973.781 NaN NaN 11.62 NaN NaN NaN NaN 76.29 NaN
4 ABW North America Aruba 2020-03-22 NaN NaN 0.286 NaN NaN 0.0 ... 35973.781 NaN NaN 11.62 NaN NaN NaN NaN 76.29 NaN
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
43067 NaN NaN International 2020-09-07 696.0 NaN NaN 7.0 NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
43068 NaN NaN International 2020-09-08 696.0 NaN NaN 7.0 NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
43069 NaN NaN International 2020-09-09 696.0 NaN NaN 7.0 NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
43070 NaN NaN International 2020-09-10 696.0 NaN NaN 7.0 NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
43071 NaN NaN International 2020-09-11 696.0 NaN NaN 7.0 NaN NaN ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

43072 rows × 41 columns

In [4]:
t_cw1 = cw1[['iso_code','location','date','total_cases']]
t_cw1[t_cw1['total_cases'].isna()]
Out[4]:
iso_code location date total_cases
1 ABW Aruba 2020-03-19 NaN
3 ABW Aruba 2020-03-21 NaN
4 ABW Aruba 2020-03-22 NaN
5 ABW Aruba 2020-03-23 NaN
13 ABW Aruba 2020-03-31 NaN
... ... ... ... ...
42015 ZAF South Africa 2020-03-03 NaN
42016 ZAF South Africa 2020-03-04 NaN
42017 ZAF South Africa 2020-03-05 NaN
42019 ZAF South Africa 2020-03-07 NaN
42023 ZAF South Africa 2020-03-11 NaN

578 rows × 4 columns

In [5]:
cw1_ = t_cw1.dropna()
In [6]:
index = t_cw1[t_cw1['location'] == 'World'].index
cw1_.drop(index, inplace=True)
C:\Users\sonal\anaconda3\lib\site-packages\pandas\core\frame.py:3990: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  return super().drop(
In [7]:
cw1_
Out[7]:
iso_code location date total_cases
0 ABW Aruba 2020-03-13 2.0
2 ABW Aruba 2020-03-20 4.0
6 ABW Aruba 2020-03-24 12.0
7 ABW Aruba 2020-03-25 17.0
8 ABW Aruba 2020-03-26 19.0
... ... ... ... ...
42555 ZWE Zimbabwe 2020-09-07 6977.0
42556 ZWE Zimbabwe 2020-09-08 7298.0
42557 ZWE Zimbabwe 2020-09-09 7388.0
42558 ZWE Zimbabwe 2020-09-10 7429.0
42559 ZWE Zimbabwe 2020-09-11 7453.0

41982 rows × 4 columns

In [8]:
cw1_.sort_values(['date'],axis =0, ascending=True, inplace=True)
<ipython-input-8-837f5ddb7dd3>:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  cw1_.sort_values(['date'],axis =0, ascending=True, inplace=True)
In [9]:
cw1_
Out[9]:
iso_code location date total_cases
21938 KOR South Korea 2019-12-31 0.0
34962 SMR San Marino 2019-12-31 0.0
10913 DOM Dominican Republic 2019-12-31 0.0
17311 HRV Croatia 2019-12-31 0.0
1622 ARM Armenia 2019-12-31 0.0
... ... ... ... ...
16931 GUM Guam 2020-09-11 1846.0
29390 NIC Nicaragua 2020-09-11 4818.0
42384 ZMB Zambia 2020-09-11 13214.0
36274 SVK Slovakia 2020-09-11 5021.0
42559 ZWE Zimbabwe 2020-09-11 7453.0

41982 rows × 4 columns

Covid19 Confirmed Cases Worldover

In [10]:
import plotly.express as px 

  
fig = px.choropleth(cw1_, 
                    locations ="iso_code", 
                    color ="total_cases", 
                    hover_name ="location",  
                    color_continuous_scale = px.colors.sequential.OrRd, 
                    scope ="world", 
                    animation_frame ="date") 
fig.show()

Asia

In [11]:
fig = px.choropleth(cw1_, 
                    locations ="iso_code", 
                    color ="total_cases", 
                    hover_name ="location",  
                    color_continuous_scale = px.colors.sequential.turbid, 
                    scope ="asia", 
                    animation_frame ="date") 
fig.show()

Europe

In [12]:
fig = px.choropleth(cw1_, 
                    locations ="iso_code", 
                    color ="total_cases", 
                    hover_name ="location",  
                    color_continuous_scale = px.colors.sequential.Aggrnyl, 
                    scope ="europe", 
                    animation_frame ="date") 
fig.show()

North America

In [13]:
fig = px.choropleth(cw1_, 
                    locations ="iso_code", 
                    color ="total_cases", 
                    hover_name ="location",  
                    color_continuous_scale = px.colors.sequential.Burg, 
                    scope ="north america", 
                    animation_frame ="date") 
fig.show()

South America

In [14]:
fig = px.choropleth(cw1_, 
                    locations ="iso_code", 
                    color ="total_cases", 
                    hover_name ="location",  
                    color_continuous_scale = px.colors.sequential.dense, 
                    scope ="south america", 
                    animation_frame ="date") 
fig.show()

Africa

In [15]:
fig = px.choropleth(cw1_, 
                    locations ="iso_code", 
                    color ="total_cases", 
                    hover_name ="location",  
                    color_continuous_scale = px.colors.sequential.Agsunset, 
                    scope ="africa", 
                    animation_frame ="date") 
fig.show()